@echo off
echo ========================================
echo 测试图片上传功能
echo ========================================

echo.
echo 1. 检查后端服务状态...
netstat -an | findstr :8080
if %errorlevel% neq 0 (
    echo 后端服务未运行，请先启动后端服务
    pause
    exit /b 1
)

echo.
echo 2. 测试静态资源访问...
powershell -Command "try { $response = Invoke-WebRequest -Uri 'http://localhost:8080/system/arrangement/test-static' -Method GET; Write-Host '状态码:' $response.StatusCode; Write-Host '响应内容:' $response.Content } catch { Write-Host '错误:' $_.Exception.Message }"

echo.
echo 3. 测试上传接口...
echo 创建一个测试图片文件...
echo 这是一个测试图片 > test-image.txt

echo.
echo 4. 使用curl测试上传...
curl -X POST -F "file=@test-image.txt" http://localhost:8080/system/arrangement/upload

echo.
echo 5. 检查上传目录...
dir "D:\Lekang\le-kang-service\lekang-lkyl\src\main\resources\static\uploads"

echo.
echo 测试完成
pause
